﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace gt.UserInfo.Intrastructures.Mapper
{
    public class DateTimeTypeConverter : ITypeConverter<DateTime, string>
    {
        public string Convert(DateTime source, string destination, ResolutionContext context)
        {
            if (source == DateTime.MinValue) return string.Empty;
            return source.ToString("yyyy-MM-dd HH:mm:ss");
        }
    }

    public class IntTypeConverter : ITypeConverter<int, bool>
    {
        public bool Convert(int source, bool destination, ResolutionContext context)
        {
            return source >= 1;
        }
    }
}
